# +----------------------------------------------------------------------
# | Pink [ A modern python web framework ]
# +----------------------------------------------------------------------
# | Copyright (c) 2023 http:#unnnnn.com All rights reserved.
# +----------------------------------------------------------------------
# | Author: chenjianhua <unnnnn@foxmail.com>
# +----------------------------------------------------------------------

from .Provider import Provider
from ..configuration import config
from ..hashing import Hash
from ..hashing.drivers import BcryptHasher, Argon2Hasher


class HashServiceProvider(Provider):
    def __init__(self, application):
        self.application = application

    def register(self):
        hashing = Hash(self.application).set_configuration(
            config("application.hashing")
        )
        hashing.add_driver("bcrypt", BcryptHasher())
        hashing.add_driver("argon2", Argon2Hasher())
        self.application.bind("hash", hashing)

    def boot(self):
        pass
